package com.abysscore.yachtdesign;
import java.awt.Color;

public class TFreeSubdivisionControlFace extends TFreeSubdivisionFace{
	private TFREESubdivisionLayer FLayer;
	private TFasterList FChildren;
	private T3DCoordinate FMin,FMax;
	private TFasterList FEdges;
	private TFasterList FControlEdges;
	
	private TFreeSubdivisionFace FGetChild(int Index)
	{
		return null;
	}
	private int FGetChildCount()
	{
		return 0;
	}
	private Color FGetColor()
	{
		return null;
	}
	private TFreeSubdivisionEdge FGetControlEdge(int Index)
	{
		return null;
	}
	private int FGetControlEdgeCount()
	{
		return 0;
	}
	private TFreeSubdivisionEdge FGetEdge(int Index)
	{
		return null;
	}
	private int FGetEdgeCount()
	{
		return 0;
	}
	private int FGetIndex()
	{
		return 0;
	}
	private boolean FGetSelected()
	{
		return false;
	}
	private boolean FGetVisible()
	{
		return false;
	}
	private boolean FSetLayer(TFREESubdivisionLayer Val)
	{
		return false;
	}
	private void FSetSelected(boolean val)
	{
		;
	}
	
	public void CalcExtents()
	{
		;
	}
	public void Clear()
	{
		;//                                                   override;
	}
	public void ClearChildren()
	{
		;
	}
	public TFreeSubdivisionControlFace(TFreeSubdivisionSurface Owner)
	{
		super(Owner);//                   override;
	}
	
	public int DistanceToCursor(int X, int Y, T3DCoordinate P, TFreeViewport Viewport)
	{
		return 0;
	}
	public void Delete()
	{
		;
	}
	//public destructor  Destroy;                                                 override;
	public void Draw(TFreeViewport Viewport)
	{
		;//                            overload;virtual;
	}
	public void Draw(TFreeViewport Viewport, double MinCurvature, double MaxCurvature)
	{
		;// reintroduce;overload;
	}
	public TFreeSubdivisionControlEdge InsertEdge(TFreeSubdivisionControlPoint P1,TFreeSubdivisionControlPoint P2)
	{
		return null;
	}
	public void LoadBinary(TFreeFileBuffer Source)
	{
		int I = 0;
		int N = 0;
		int Index=-1;
		TFreeSubdivisionControlPoint P1;
		TFreeSubdivisionControlPoint P2;
		TFreeSubdivisionControlEdge Edge;
		boolean Sel=false;

		// Read controlpoint data
		Source.Load(N);
		FPoints.Clear();
		FPoints.Capacity(N);
		for(I=1; I<=N; I++)
		{
			Source.Load(Index);
			if (Index==-1)
				Index=0;
			else
			{
				P1=(TFreeSubdivisionControlPoint) Owner().ControlPoints(Index);
				FPoints.Add(P1);
				P1.AddFace(this);
			}
		}
		// Read layer-index
		Source.Load(Index);
		if ((Index>=0) && (Index<Owner().NumberOfLayers()))
		{
			FLayer=Owner().Layer(Index);
		}
		else
		{
			FLayer=Owner().Layer(0); // Reference to an invalid layer. Assign to owners default layer
		}
		if (FLayer!=null)
			FLayer.AddControlFace(this);
		else 
			System.err.println("Invalid layer reference in procedure TFreeSubdivisionControlFace.LoadBinary!");

		Source.Load(Sel);
		if (Sel)
			Selected(true);
		P1=(TFreeSubdivisionControlPoint) FPoints.Objects(NumberOfpoints()-1);
		for (I=1; I<=NumberOfpoints(); I++)	
		{
			P2=(TFreeSubdivisionControlPoint) FPoints.Objects(I-1);
			Edge=(TFreeSubdivisionControlEdge) Owner().EdgeExists(P1,P2);//?? as TFreeSubdivisionControlEdge;
			if (Edge!=null)
				Edge.AddFace(this);
			else
			{
				Edge=Owner().AddControlEdge(P1,P2);
				Edge.Crease(true);
				//MessageDlg('Could not find edge!',mtError,[mbOk],0);
				System.err.println("Could not find edge!");
			}
			P1=P2;
	   }
	}
	public void LoadFromStream(int LineNr, TStringList Strings)
	{
		;
	}
	public void RemoveReferences()
	{
		;
	}
	public void SaveBinary(TFreeFileBuffer Destination)
	{
		;
	}
	public void SaveToDXF(TStringList Strings)
	{
		;
	}
	public void SaveToStream(TStringList Strings)
	{
		;//                       virtual;
	}
	public void Subdivide(TFreeSubdivisionSurface Owner, boolean ControlFace, TFasterList VertexPoints, TFasterList EdgePoints, TFasterList FacePoints, TFasterList InteriorEdges, TFasterList ControlEdges, TFasterList Dest)
	{
		;
	}
	public void Trace()
	{
		;  // select all controlfaces connected to the current one that belong to the same layer and are not separated by a crease edge
	}
	
	public Color Color() { return FGetColor(); }
	public TFreeSubdivisionEdge ControlEdge(int index) { return FGetControlEdge(index); }
	public int ControlEdgeCount() { return FGetControlEdgeCount(); }
	public TFreeSubdivisionFace Child(int index) { return FGetChild(index); }
	public int ChildCount() { return FGetChildCount(); }
	public TFreeSubdivisionEdge Edge(int index) { return FGetEdge(index); }
	public int EdgeCount() { return FGetEdgeCount(); }
	public int FaceIndex() { return FGetIndex(); }
	public TFREESubdivisionLayer Layer() { return FLayer; }
	public void Layer(TFREESubdivisionLayer item) { FSetLayer(item); }
	public T3DCoordinate Max() { return FMax; }
	public T3DCoordinate Min() { return FMin; }
	public boolean Selected() { return FGetSelected(); }
	public void Selected(boolean val) { FSetSelected(val); }       // Property to see if this controlface has been selected by the user
 	public boolean Visible() { return FGetVisible(); }
}
